/**
 * Copyright (c) 2013-2022, Alibaba Group Holding Limited;
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * </p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: TxnStream.proto

package com.aliyun.polardbx.binlog.protocol;

/**
 * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnItem}
 */
public final class TxnItem extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:com.aliyun.polardbx.binlog.protocol.TxnItem)
    TxnItemOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TxnItem.newBuilder() to construct.
  private TxnItem(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private TxnItem() {
    traceId_ = "";
    payload_ = com.google.protobuf.ByteString.EMPTY;
    rowsQuery_ = "";
    schema_ = "";
    table_ = "";
    primaryKey_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new TxnItem();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private TxnItem(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            traceId_ = s;
            break;
          }
          case 16: {

            eventType_ = input.readInt32();
            break;
          }
          case 26: {

            payload_ = input.readBytes();
            break;
          }
          case 34: {
            java.lang.String s = input.readStringRequireUtf8();

            rowsQuery_ = s;
            break;
          }
          case 42: {
            java.lang.String s = input.readStringRequireUtf8();

            schema_ = s;
            break;
          }
          case 50: {
            java.lang.String s = input.readStringRequireUtf8();

            table_ = s;
            break;
          }
          case 56: {

            hashKey_ = input.readInt32();
            break;
          }
          case 66: {
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              primaryKey_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
              mutable_bitField0_ |= 0x00000001;
            }
            primaryKey_.add(input.readBytes());
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); // C
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.aliyun.polardbx.binlog.protocol.TxnItem.class, com.aliyun.polardbx.binlog.protocol.TxnItem.Builder.class);
  }

  public static final int TRACEID_FIELD_NUMBER = 1;
  private volatile java.lang.Object traceId_;
  /**
   * <pre>
   **
   *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
   *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
   *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
   * </pre>
   *
   * <code>string traceId = 1;</code>
   * @return The traceId.
   */
  @java.lang.Override
  public java.lang.String getTraceId() {
    java.lang.Object ref = traceId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      traceId_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
   *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
   *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
   * </pre>
   *
   * <code>string traceId = 1;</code>
   * @return The bytes for traceId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getTraceIdBytes() {
    java.lang.Object ref = traceId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      traceId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int EVENTTYPE_FIELD_NUMBER = 2;
  private int eventType_;
  /**
   * <pre>
   **
   *1.对应mysql的EventType
   * </pre>
   *
   * <code>int32 eventType = 2;</code>
   * @return The eventType.
   */
  @java.lang.Override
  public int getEventType() {
    return eventType_;
  }

  public static final int PAYLOAD_FIELD_NUMBER = 3;
  private com.google.protobuf.ByteString payload_;
  /**
   * <pre>
   **
   *1.二进制数据，对应binlog event
   * </pre>
   *
   * <code>bytes payload = 3;</code>
   * @return The payload.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getPayload() {
    return payload_;
  }

  public static final int ROWSQUERY_FIELD_NUMBER = 4;
  private volatile java.lang.Object rowsQuery_;
  /**
   * <pre>
   **
   *1.保存RowsQuery信息
   * </pre>
   *
   * <code>string rowsQuery = 4;</code>
   * @return The rowsQuery.
   */
  @java.lang.Override
  public java.lang.String getRowsQuery() {
    java.lang.Object ref = rowsQuery_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      rowsQuery_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *1.保存RowsQuery信息
   * </pre>
   *
   * <code>string rowsQuery = 4;</code>
   * @return The bytes for rowsQuery.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getRowsQueryBytes() {
    java.lang.Object ref = rowsQuery_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      rowsQuery_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SCHEMA_FIELD_NUMBER = 5;
  private volatile java.lang.Object schema_;
  /**
   * <pre>
   **
   *对应的库名
   * </pre>
   *
   * <code>string schema = 5;</code>
   * @return The schema.
   */
  @java.lang.Override
  public java.lang.String getSchema() {
    java.lang.Object ref = schema_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      schema_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *对应的库名
   * </pre>
   *
   * <code>string schema = 5;</code>
   * @return The bytes for schema.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getSchemaBytes() {
    java.lang.Object ref = schema_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      schema_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TABLE_FIELD_NUMBER = 6;
  private volatile java.lang.Object table_;
  /**
   * <pre>
   **
   *对应的表名
   * </pre>
   *
   * <code>string table = 6;</code>
   * @return The table.
   */
  @java.lang.Override
  public java.lang.String getTable() {
    java.lang.Object ref = table_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      table_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *对应的表名
   * </pre>
   *
   * <code>string table = 6;</code>
   * @return The bytes for table.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getTableBytes() {
    java.lang.Object ref = table_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      table_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int HASHKEY_FIELD_NUMBER = 7;
  private int hashKey_;
  /**
   * <pre>
   **
   *参与dispatcher 分发的hashKey
   * </pre>
   *
   * <code>int32 hashKey = 7;</code>
   * @return The hashKey.
   */
  @java.lang.Override
  public int getHashKey() {
    return hashKey_;
  }

  public static final int PRIMARYKEY_FIELD_NUMBER = 8;
  private java.util.List<com.google.protobuf.ByteString> primaryKey_;
  /**
   * <pre>
   **
   *主键信息
   * </pre>
   *
   * <code>repeated bytes primaryKey = 8;</code>
   * @return A list containing the primaryKey.
   */
  @java.lang.Override
  public java.util.List<com.google.protobuf.ByteString>
      getPrimaryKeyList() {
    return primaryKey_;
  }
  /**
   * <pre>
   **
   *主键信息
   * </pre>
   *
   * <code>repeated bytes primaryKey = 8;</code>
   * @return The count of primaryKey.
   */
  public int getPrimaryKeyCount() {
    return primaryKey_.size();
  }
  /**
   * <pre>
   **
   *主键信息
   * </pre>
   *
   * <code>repeated bytes primaryKey = 8;</code>
   * @param index The index of the element to return.
   * @return The primaryKey at the given index.
   */
  public com.google.protobuf.ByteString getPrimaryKey(int index) {
    return primaryKey_.get(index);
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getTraceIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, traceId_);
    }
    if (eventType_ != 0) {
      output.writeInt32(2, eventType_);
    }
    if (!payload_.isEmpty()) {
      output.writeBytes(3, payload_);
    }
    if (!getRowsQueryBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, rowsQuery_);
    }
    if (!getSchemaBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 5, schema_);
    }
    if (!getTableBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, table_);
    }
    if (hashKey_ != 0) {
      output.writeInt32(7, hashKey_);
    }
    for (int i = 0; i < primaryKey_.size(); i++) {
      output.writeBytes(8, primaryKey_.get(i));
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getTraceIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, traceId_);
    }
    if (eventType_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(2, eventType_);
    }
    if (!payload_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(3, payload_);
    }
    if (!getRowsQueryBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, rowsQuery_);
    }
    if (!getSchemaBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, schema_);
    }
    if (!getTableBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, table_);
    }
    if (hashKey_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(7, hashKey_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < primaryKey_.size(); i++) {
        dataSize += com.google.protobuf.CodedOutputStream
          .computeBytesSizeNoTag(primaryKey_.get(i));
      }
      size += dataSize;
      size += 1 * getPrimaryKeyList().size();
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.aliyun.polardbx.binlog.protocol.TxnItem)) {
      return super.equals(obj);
    }
    com.aliyun.polardbx.binlog.protocol.TxnItem other = (com.aliyun.polardbx.binlog.protocol.TxnItem) obj;

    if (!getTraceId()
        .equals(other.getTraceId())) return false;
    if (getEventType()
        != other.getEventType()) return false;
    if (!getPayload()
        .equals(other.getPayload())) return false;
    if (!getRowsQuery()
        .equals(other.getRowsQuery())) return false;
    if (!getSchema()
        .equals(other.getSchema())) return false;
    if (!getTable()
        .equals(other.getTable())) return false;
    if (getHashKey()
        != other.getHashKey()) return false;
    if (!getPrimaryKeyList()
        .equals(other.getPrimaryKeyList())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + TRACEID_FIELD_NUMBER;
    hash = (53 * hash) + getTraceId().hashCode();
    hash = (37 * hash) + EVENTTYPE_FIELD_NUMBER;
    hash = (53 * hash) + getEventType();
    hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
    hash = (53 * hash) + getPayload().hashCode();
    hash = (37 * hash) + ROWSQUERY_FIELD_NUMBER;
    hash = (53 * hash) + getRowsQuery().hashCode();
    hash = (37 * hash) + SCHEMA_FIELD_NUMBER;
    hash = (53 * hash) + getSchema().hashCode();
    hash = (37 * hash) + TABLE_FIELD_NUMBER;
    hash = (53 * hash) + getTable().hashCode();
    hash = (37 * hash) + HASHKEY_FIELD_NUMBER;
    hash = (53 * hash) + getHashKey();
    if (getPrimaryKeyCount() > 0) {
      hash = (37 * hash) + PRIMARYKEY_FIELD_NUMBER;
      hash = (53 * hash) + getPrimaryKeyList().hashCode();
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnItem parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.aliyun.polardbx.binlog.protocol.TxnItem prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnItem}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:com.aliyun.polardbx.binlog.protocol.TxnItem)
      com.aliyun.polardbx.binlog.protocol.TxnItemOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.aliyun.polardbx.binlog.protocol.TxnItem.class, com.aliyun.polardbx.binlog.protocol.TxnItem.Builder.class);
    }

    // Construct using com.aliyun.polardbx.binlog.protocol.TxnItem.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      traceId_ = "";

      eventType_ = 0;

      payload_ = com.google.protobuf.ByteString.EMPTY;

      rowsQuery_ = "";

      schema_ = "";

      table_ = "";

      hashKey_ = 0;

      primaryKey_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000001);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnItem_descriptor;
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstanceForType() {
      return com.aliyun.polardbx.binlog.protocol.TxnItem.getDefaultInstance();
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnItem build() {
      com.aliyun.polardbx.binlog.protocol.TxnItem result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnItem buildPartial() {
      com.aliyun.polardbx.binlog.protocol.TxnItem result = new com.aliyun.polardbx.binlog.protocol.TxnItem(this);
      int from_bitField0_ = bitField0_;
      result.traceId_ = traceId_;
      result.eventType_ = eventType_;
      result.payload_ = payload_;
      result.rowsQuery_ = rowsQuery_;
      result.schema_ = schema_;
      result.table_ = table_;
      result.hashKey_ = hashKey_;
      if (((bitField0_ & 0x00000001) != 0)) {
        primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_);
        bitField0_ = (bitField0_ & ~0x00000001);
      }
      result.primaryKey_ = primaryKey_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.aliyun.polardbx.binlog.protocol.TxnItem) {
        return mergeFrom((com.aliyun.polardbx.binlog.protocol.TxnItem)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.aliyun.polardbx.binlog.protocol.TxnItem other) {
      if (other == com.aliyun.polardbx.binlog.protocol.TxnItem.getDefaultInstance()) return this;
      if (!other.getTraceId().isEmpty()) {
        traceId_ = other.traceId_;
        onChanged();
      }
      if (other.getEventType() != 0) {
        setEventType(other.getEventType());
      }
      if (other.getPayload() != com.google.protobuf.ByteString.EMPTY) {
        setPayload(other.getPayload());
      }
      if (!other.getRowsQuery().isEmpty()) {
        rowsQuery_ = other.rowsQuery_;
        onChanged();
      }
      if (!other.getSchema().isEmpty()) {
        schema_ = other.schema_;
        onChanged();
      }
      if (!other.getTable().isEmpty()) {
        table_ = other.table_;
        onChanged();
      }
      if (other.getHashKey() != 0) {
        setHashKey(other.getHashKey());
      }
      if (!other.primaryKey_.isEmpty()) {
        if (primaryKey_.isEmpty()) {
          primaryKey_ = other.primaryKey_;
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          ensurePrimaryKeyIsMutable();
          primaryKey_.addAll(other.primaryKey_);
        }
        onChanged();
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.aliyun.polardbx.binlog.protocol.TxnItem parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.aliyun.polardbx.binlog.protocol.TxnItem) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.lang.Object traceId_ = "";
    /**
     * <pre>
     **
     *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     * @return The traceId.
     */
    public java.lang.String getTraceId() {
      java.lang.Object ref = traceId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        traceId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     * @return The bytes for traceId.
     */
    public com.google.protobuf.ByteString
        getTraceIdBytes() {
      java.lang.Object ref = traceId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        traceId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     * @param value The traceId to set.
     * @return This builder for chaining.
     */
    public Builder setTraceId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      traceId_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearTraceId() {
      
      traceId_ = getDefaultInstance().getTraceId();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.traceId是分布式事务内，合并多个物理分片的事件时，进行排序的依据&lt;/br&gt;
     *2.为了便于统一处理，不管是单机事务还是分布式事务都要求传入，并且要保证同一事务在同一物理分片的traceID单调递增 &lt;/br&gt;
     *3.如果物理binlog中带有traceId标识，直接使用即可；如果物理binlog中不带有traceId标识，通过"时间戳+自增序列"手动生成 &lt;/br&gt;
     * </pre>
     *
     * <code>string traceId = 1;</code>
     * @param value The bytes for traceId to set.
     * @return This builder for chaining.
     */
    public Builder setTraceIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      traceId_ = value;
      onChanged();
      return this;
    }

    private int eventType_ ;
    /**
     * <pre>
     **
     *1.对应mysql的EventType
     * </pre>
     *
     * <code>int32 eventType = 2;</code>
     * @return The eventType.
     */
    @java.lang.Override
    public int getEventType() {
      return eventType_;
    }
    /**
     * <pre>
     **
     *1.对应mysql的EventType
     * </pre>
     *
     * <code>int32 eventType = 2;</code>
     * @param value The eventType to set.
     * @return This builder for chaining.
     */
    public Builder setEventType(int value) {
      
      eventType_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.对应mysql的EventType
     * </pre>
     *
     * <code>int32 eventType = 2;</code>
     * @return This builder for chaining.
     */
    public Builder clearEventType() {
      
      eventType_ = 0;
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString payload_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <pre>
     **
     *1.二进制数据，对应binlog event
     * </pre>
     *
     * <code>bytes payload = 3;</code>
     * @return The payload.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getPayload() {
      return payload_;
    }
    /**
     * <pre>
     **
     *1.二进制数据，对应binlog event
     * </pre>
     *
     * <code>bytes payload = 3;</code>
     * @param value The payload to set.
     * @return This builder for chaining.
     */
    public Builder setPayload(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      payload_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.二进制数据，对应binlog event
     * </pre>
     *
     * <code>bytes payload = 3;</code>
     * @return This builder for chaining.
     */
    public Builder clearPayload() {
      
      payload_ = getDefaultInstance().getPayload();
      onChanged();
      return this;
    }

    private java.lang.Object rowsQuery_ = "";
    /**
     * <pre>
     **
     *1.保存RowsQuery信息
     * </pre>
     *
     * <code>string rowsQuery = 4;</code>
     * @return The rowsQuery.
     */
    public java.lang.String getRowsQuery() {
      java.lang.Object ref = rowsQuery_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        rowsQuery_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *1.保存RowsQuery信息
     * </pre>
     *
     * <code>string rowsQuery = 4;</code>
     * @return The bytes for rowsQuery.
     */
    public com.google.protobuf.ByteString
        getRowsQueryBytes() {
      java.lang.Object ref = rowsQuery_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        rowsQuery_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *1.保存RowsQuery信息
     * </pre>
     *
     * <code>string rowsQuery = 4;</code>
     * @param value The rowsQuery to set.
     * @return This builder for chaining.
     */
    public Builder setRowsQuery(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      rowsQuery_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.保存RowsQuery信息
     * </pre>
     *
     * <code>string rowsQuery = 4;</code>
     * @return This builder for chaining.
     */
    public Builder clearRowsQuery() {
      
      rowsQuery_ = getDefaultInstance().getRowsQuery();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.保存RowsQuery信息
     * </pre>
     *
     * <code>string rowsQuery = 4;</code>
     * @param value The bytes for rowsQuery to set.
     * @return This builder for chaining.
     */
    public Builder setRowsQueryBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      rowsQuery_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object schema_ = "";
    /**
     * <pre>
     **
     *对应的库名
     * </pre>
     *
     * <code>string schema = 5;</code>
     * @return The schema.
     */
    public java.lang.String getSchema() {
      java.lang.Object ref = schema_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        schema_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *对应的库名
     * </pre>
     *
     * <code>string schema = 5;</code>
     * @return The bytes for schema.
     */
    public com.google.protobuf.ByteString
        getSchemaBytes() {
      java.lang.Object ref = schema_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        schema_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *对应的库名
     * </pre>
     *
     * <code>string schema = 5;</code>
     * @param value The schema to set.
     * @return This builder for chaining.
     */
    public Builder setSchema(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      schema_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *对应的库名
     * </pre>
     *
     * <code>string schema = 5;</code>
     * @return This builder for chaining.
     */
    public Builder clearSchema() {
      
      schema_ = getDefaultInstance().getSchema();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *对应的库名
     * </pre>
     *
     * <code>string schema = 5;</code>
     * @param value The bytes for schema to set.
     * @return This builder for chaining.
     */
    public Builder setSchemaBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      schema_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object table_ = "";
    /**
     * <pre>
     **
     *对应的表名
     * </pre>
     *
     * <code>string table = 6;</code>
     * @return The table.
     */
    public java.lang.String getTable() {
      java.lang.Object ref = table_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        table_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *对应的表名
     * </pre>
     *
     * <code>string table = 6;</code>
     * @return The bytes for table.
     */
    public com.google.protobuf.ByteString
        getTableBytes() {
      java.lang.Object ref = table_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        table_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *对应的表名
     * </pre>
     *
     * <code>string table = 6;</code>
     * @param value The table to set.
     * @return This builder for chaining.
     */
    public Builder setTable(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      table_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *对应的表名
     * </pre>
     *
     * <code>string table = 6;</code>
     * @return This builder for chaining.
     */
    public Builder clearTable() {
      
      table_ = getDefaultInstance().getTable();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *对应的表名
     * </pre>
     *
     * <code>string table = 6;</code>
     * @param value The bytes for table to set.
     * @return This builder for chaining.
     */
    public Builder setTableBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      table_ = value;
      onChanged();
      return this;
    }

    private int hashKey_ ;
    /**
     * <pre>
     **
     *参与dispatcher 分发的hashKey
     * </pre>
     *
     * <code>int32 hashKey = 7;</code>
     * @return The hashKey.
     */
    @java.lang.Override
    public int getHashKey() {
      return hashKey_;
    }
    /**
     * <pre>
     **
     *参与dispatcher 分发的hashKey
     * </pre>
     *
     * <code>int32 hashKey = 7;</code>
     * @param value The hashKey to set.
     * @return This builder for chaining.
     */
    public Builder setHashKey(int value) {
      
      hashKey_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *参与dispatcher 分发的hashKey
     * </pre>
     *
     * <code>int32 hashKey = 7;</code>
     * @return This builder for chaining.
     */
    public Builder clearHashKey() {
      
      hashKey_ = 0;
      onChanged();
      return this;
    }

    private java.util.List<com.google.protobuf.ByteString> primaryKey_ = java.util.Collections.emptyList();
    private void ensurePrimaryKeyIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        primaryKey_ = new java.util.ArrayList<com.google.protobuf.ByteString>(primaryKey_);
        bitField0_ |= 0x00000001;
       }
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @return A list containing the primaryKey.
     */
    public java.util.List<com.google.protobuf.ByteString>
        getPrimaryKeyList() {
      return ((bitField0_ & 0x00000001) != 0) ?
               java.util.Collections.unmodifiableList(primaryKey_) : primaryKey_;
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @return The count of primaryKey.
     */
    public int getPrimaryKeyCount() {
      return primaryKey_.size();
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @param index The index of the element to return.
     * @return The primaryKey at the given index.
     */
    public com.google.protobuf.ByteString getPrimaryKey(int index) {
      return primaryKey_.get(index);
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @param index The index to set the value at.
     * @param value The primaryKey to set.
     * @return This builder for chaining.
     */
    public Builder setPrimaryKey(
        int index, com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  ensurePrimaryKeyIsMutable();
      primaryKey_.set(index, value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @param value The primaryKey to add.
     * @return This builder for chaining.
     */
    public Builder addPrimaryKey(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  ensurePrimaryKeyIsMutable();
      primaryKey_.add(value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @param values The primaryKey to add.
     * @return This builder for chaining.
     */
    public Builder addAllPrimaryKey(
        java.lang.Iterable<? extends com.google.protobuf.ByteString> values) {
      ensurePrimaryKeyIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(
          values, primaryKey_);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *主键信息
     * </pre>
     *
     * <code>repeated bytes primaryKey = 8;</code>
     * @return This builder for chaining.
     */
    public Builder clearPrimaryKey() {
      primaryKey_ = java.util.Collections.emptyList();
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:com.aliyun.polardbx.binlog.protocol.TxnItem)
  }

  // @@protoc_insertion_point(class_scope:com.aliyun.polardbx.binlog.protocol.TxnItem)
  private static final com.aliyun.polardbx.binlog.protocol.TxnItem DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.aliyun.polardbx.binlog.protocol.TxnItem();
  }

  public static com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TxnItem>
      PARSER = new com.google.protobuf.AbstractParser<TxnItem>() {
    @java.lang.Override
    public TxnItem parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new TxnItem(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<TxnItem> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<TxnItem> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.aliyun.polardbx.binlog.protocol.TxnItem getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

